import { getCurrentInstance } from "vue";

export function useApi() {
  const instance = getCurrentInstance();
  if (!instance) {
    throw new Error("useApi() 只能在 setup 或生命周期钩子中使用");
  }
  return instance.proxy!.$api;
}